package com.afu.aopDemo.config;

import com.afu.aopDemo.interception.MyInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * ClassName: MyConfig
 * Package: com.afu.aopDemo.config
 * Description:
 *
 * @Author zxf
 * @Create 2024/2/2 12:02
 * @Version 1.0
 */

@Configuration
public class MyConfig implements WebMvcConfigurer {
    @Autowired
    private MyInterceptor myInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(myInterceptor).addPathPatterns("/demo/**");
    }
}
